<template>
	<page-body>
		<view class="page">
			<view class="flex flex-wrap align-center justify-between benben-position-layout flex forgetPasswords_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center forgetPasswords_fd0_0'>
					<image class='forgetPasswords_fd0_0_c0' mode="aspectFit" :src='STATIC_URL+"1576.png"'
						@tap.stop="handleJumpDiy" data-type="back" data-url="1"></image>
				</view>
				<view class='flex flex-wrap align-center forgetPasswords_fd0_0'>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout forgetPasswords_flex_1">
				<view class='flex flex-direction  align-center  benben-flex-layout     forgetPasswords_fd1_0'>
					<image class='forgetPasswords_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"1661.png"'></image>
					<view class='forgetPasswords_fd1_0_c1'>重置密码</view>
				</view>
				<view class='flex flex-wrap align-center forgetPasswords_fd1_1'>
					<image class='forgetPasswords_fd1_1_c0' mode="aspectFit" :src='STATIC_URL+"3.png"'></image>
					<benben-input class='flex-sub forgetPasswords_fd1_1_c1' type="text" placeholder="请输入手机号"
						confirm-type="done" :maxlength="11" placeholder-style="color:#999;font-size:28rpx"
						v-model="mobile" />
				</view>
				<view class='flex flex-wrap align-center forgetPasswords_fd1_2'>
					<image class='forgetPasswords_fd1_1_c0' mode="aspectFit" :src='STATIC_URL+"7.png"'></image>
					<benben-input class='flex-sub forgetPasswords_fd1_1_c1' type="number" :placeholder="$t('请输入验证码')"
						confirm-type="done" :maxlength="6" placeholder-style="color:#999;font-size:28rpx"
						v-model="code" />
						 <benben-send-verification-code key='1724830134548' ref="vCode1724830134548" class='newPhone_fd1_0_c1_c2'
						              after-text='后重新获取' before-text='获取验证码' emptye-text='请输入账号' validate-text='请输入正确账号' account-type='phone'
						              :auto='true' :is-environment-verification='true' type='2' :phone="mobile"></benben-send-verification-code>
					<!-- <benben-send-verification-code key='1707097245486' ref="vCode1707097245486"
						class=' forgetPasswords_fd1_2_c2' :after-text="$t('后重新获取')" :before-text="$t('获取验证码')"
						emptye-text="请输入手机号" validate-text="请输入正确的手机号" account-type='phone' :auto='true'
						type='2' :is-environment-verification='false' :phone="mobile"></benben-send-verification-code> -->
				</view>
				<view class='flex flex-wrap align-center forgetPasswords_fd1_3'>
					<image class='forgetPasswords_fd1_1_c0' mode="aspectFit" :src='STATIC_URL+"4.png"'></image>
					<benben-flex-password-diy v-model="password"
						class-name="flex flex align-center forgetPasswords_fd1_3_c1"
						:placeholder="$t('请输入新密码(6~12位字母+数字)')" :maxlength="12" :default-type='true'
						placeholder-style="color:#999;font-size:28rpx">
						<template #show>
							<text class='fu-iconfont2  forgetPasswords_fd1_3_c1_icon1' data-type="show">&#xE837;</text>
						</template>
						<template #hide>
							<text class='fu-iconfont2  forgetPasswords_fd1_3_c1_icon1' data-type="hide">&#xEBCC;</text>
						</template>
					</benben-flex-password-diy>
				</view>
				<view class='flex flex-wrap align-center forgetPasswords_fd1_3'>
					<image class='forgetPasswords_fd1_1_c0' mode="aspectFit" :src='STATIC_URL+"4.png"'></image>
					<benben-flex-password-diy v-model="confirm_password"
						class-name="flex flex align-center forgetPasswords_fd1_3_c1"
						:placeholder="$t('请输入确认新密码(6~12位字母+数字)')" :maxlength="12" :default-type='true'
						placeholder-style="color:#999;font-size:28rpx">
						<template #show>
							<text class='fu-iconfont2  forgetPasswords_fd1_3_c1_icon1' data-type="show">&#xE837;</text>
						</template>
						<template #hide>
							<text class='fu-iconfont2  forgetPasswords_fd1_3_c1_icon1' data-type="hide">&#xEBCC;</text>
						</template>
					</benben-flex-password-diy>
				</view>
				<!-- <view class='flex flex-wrap align-center justify-end forgetPasswords_fd1_4'>
					<text class='forgetPasswords_fd1_4_c0' @tap.stop="handleJumpDiy" data-type="navigateTo"
						:data-url="`/pages/dlzc/phoneNumber/phoneNumber`">{{$t('绑定手机号')}}</text>
				</view> -->
				<button class='forgetPasswords_fd1_5' @tap.stop="forgetpswdFunc()">{{$t('确定')}}</button>
			</view>

			<!---flex布局flex布局结束-->


		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"is_tk": false,
				"password": "",
				"confirm_password": "",
				"code": "",
				"mobile": "",
				tabs:'',//1 学生  2教师
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.tabs=options.tab
			uni.setStorageSync('USER_GROUP',this.tabs)
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//忘记密码
			async forgetpswdFunc() {
				if (!validate(this.mobile, 'require')) {
					this.$message.info(global.i18n.t('请输入手机号'));
					return false;
				}
				if (!validate(this.mobile, 'phone')) {
					this.$message.info(global.i18n.t('请输入正确的手机号'));
					return false;
				}
				if (!validate(this.code, 'require')) {
					this.$message.info(global.i18n.t('请输入验证码'));
					return false;
				}
				if (!validate(this.code, 'captcha')) {
					this.$message.info(global.i18n.t('请输入正确的验证码'));
					return false;
				}
				if (!validate(this.password, 'require')) {
					this.$message.info(global.i18n.t('请输入新密码'));
					return false;
				}
				if (!validate(this.password, 'password')) {
					this.$message.info(global.i18n.t('请输入确认新密码（6~12位字母+数字）'));
					return false;
				}
				if (!validate(this.confirm_password, 'require')) {
					this.$message.info(global.i18n.t('请输入确认密码'));
					return false;
				}
				if (!validate(this.confirm_password, 'password')) {
					this.$message.info(global.i18n.t('请输入正确的确认新密码（6~12位字母+数字）'));
					return false;
				}
				if(this.confirm_password !=this.password){
					this.$message.info('密码不一致')
					return
				}
				//请求方法
				//数据验证

				// let data5f6db4db8abcf = await this.$api.post(global.apiUrls.post5f6db4db8abcf, {
				// 	mobile: this.mobile,
				// 	code: this.code,
				// 	type: '2'
				// });

				// if (data5f6db4db8abcf.data.code != 1) {
				// 	this.$message.info(data5f6db4db8abcf.data.msg);
				// 	return
				// }
				// let info5f6db4db8abcf = data5f6db4db8abcf.data;


				//请求方法
				//数据验证

				let data5caeeba9866aa = await this.$api.dbPost(global.apiUrls.post5caeeba9866aa, {
					password: this.password,
					confirm_password: this.confirm_password,
					account: this.mobile,
					code: this.code,
					type: '2',
					account_type: 'mobile'
				});
				if (!data5caeeba9866aa) return
				if (data5caeeba9866aa.data.code != 1) {
					this.$message.info(data5caeeba9866aa.data.msg);
					return
				}
				this.$message.info('修改成功')
				setTimeout(() => {
					uni.navigateBack()
				}, 800)
				
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: url(image-path('1663.png')) no-repeat;
		background-size: 100% auto;
	}

	.forgetPasswords_flex_0 {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
	}

	.forgetPasswords_fd0_0_c0 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
	}

	.forgetPasswords_fd0_0 {
		width: 100rpx;
		height: 88rpx;
	}

	.forgetPasswords_flex_1 {
		padding: 0rpx 56rpx 0rpx 56rpx;
		// background-color: #ffffff;
	}

	.forgetPasswords_fd1_5 {
		background: #134ddf;
		border-radius: 50rpx 50rpx 50rpx 50rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor3);
		width: 638rpx;
		height: 88rpx;
		line-height: 88rpx;
		margin: 100rpx 0rpx 32rpx 0rpx;
	}

	.forgetPasswords_fd1_4_c0 {
		margin: 24rpx 0rpx 0rpx 0rpx;
		text-align: right;
		color: rgba(51, 51, 51, 1);
	}

	.forgetPasswords_fd1_4 {
		padding: 0rpx 32rpx 0rpx 0rpx;
	}

	.forgetPasswords_fd1_3_c1_icon1 {
		width: 88rpx;
		line-height: 88rpx;
		text-align: center;
		font-size: 40rpx;
	}

	::v-deep .forgetPasswords_fd1_3_c1 {
		height: 88rpx;
		width: 500rpx;
		font-size: 32rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
	}

	.forgetPasswords_fd1_3 {
		// background: #E8EEFF;
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		// box-shadow: 0rpx 3rpx 6rpx 1rpx #FFF2F4;
		border-bottom: 2rpx solid #f5f5f5;
		margin: 32rpx 0rpx 0rpx 0rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.forgetPasswords_fd1_2_c2 {
		background: #134ddf;
		width: 200rpx;
		height: 64rpx;
		line-height: 64rpx;
		text-align: center;
		border-radius: 32rpx;
		background-size: 100% auto;
		color: rgba(255, 255, 255, 1);
	}

	.forgetPasswords_fd1_2 {
		// background: #E8EEFF;
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		// box-shadow: 0rpx 3rpx 6rpx 1rpx #FFF2F4;
		border-bottom: 2rpx solid #f5f5f5;
		padding: 0rpx 10rpx 0rpx 32rpx;
	}

	.forgetPasswords_fd1_1_c1 {
		height: 88rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
		color: var(--benbenFontColor0);
		font-size: 28rpx;
		font-weight: 400;
		line-height: 40rpx;
	}

	.forgetPasswords_fd1_1_c0 {
		width: 34rpx;
		height: 34rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.forgetPasswords_fd1_1 {
		// background: #E8EEFF;
		// border-radius: 44rpx 44rpx 44rpx 44rpx;
		// box-shadow: 0rpx 3rpx 6rpx 1rpx #FFF2F4;
		border-bottom: 2rpx solid #f5f5f5;
		padding: 0rpx 32rpx 0rpx 32rpx;
		margin: 84rpx 0rpx 32rpx 0rpx;
	}

	.forgetPasswords_fd1_0_c1 {
		line-height: 75rpx;
		height: 75rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		font-size: 54rpx;
		color: #333333;
		text-align: center;
		font-style: normal;
		text-transform: none;
	}

	.forgetPasswords_fd1_0_c0 {
		width: 220rpx;
		height: 180rpx;
	}

	.forgetPasswords_fd1_0 {
		margin: 84rpx 0rpx 0rpx 0rpx;
		// height: 230rpx;
		width: 100%;
	}
</style>